import request from '../utils/request';

/**
 * 查询字典列表分页
 * @param query
 * @returns {AxiosPromise}
 */
export const selectPage = query => {
    return request({
        url: 'rest/dictionary/selectPage',
        method: 'POST',
        data: query
    });
};


/**
 * 新增字典
 * @param query
 * @returns {AxiosPromise}
 */
export const addDictionary = query => {
    return request({
        url: 'rest/dictionary/insert',
        method: 'POST',
        data: query
    });
};


/**
 * 编辑字典
 * @param query
 * @returns {AxiosPromise}
 */
export const updateDictionary = query => {
    return request({
        url: 'rest/dictionary/update',
        method: 'POST',
        data: query
    });
};

/**
 * 删除字典
 * @param query
 * @returns {AxiosPromise}
 */
export const delDictionary = query => {
    return request({
        url: 'rest/dictionary/delete',
        method: 'POST',
        data: query
    });
};

/**
 * 查询分组
 * @param query
 * @returns {AxiosPromise}
 */
export const selectDicGroup = query => {
    return request({
        url: 'rest/dictionary/selectGroup',
        method: 'POST',
        data: query
    });
};

/**
 * 查询字典表
 * @param query
 * @returns {AxiosPromise}
 */
export const getDictionaryByID = query => {
    return request({
        url: 'rest/dictionary/' + query,
        method: 'POST',
    });
};

/**
 * 查询字典表List
 * @param query
 * @returns {AxiosPromise}
 */
export const getDictionarys = query => {
    return request({
        url: 'rest/dictionary/getDictionarys?groupName=' + query,
        method: 'POST',
    });
};